﻿ //21.Write a program that reads two numbers N and K and generates all the combinations of K distinct elements from the set [1..N].
 //Example: N = 5, K = 2 -> {1, 2}, {1, 3}, {1, 4}, {1, 5}, {2, 3}, {2, 4}, {2, 5}, {3, 4}, {3, 5}, {4, 5}
 
using System;
using System.Collections.Generic;

class Combinations
{
    static void Main()
    {
        int numberN = int.Parse(Console.ReadLine());
        int numberK = int.Parse(Console.ReadLine());
        int[] arrK = new int[numberK];
        int start = 1;
        CombinationsCalc(arrK, start, numberK - 1, numberN);
    }

    static void CombinationsCalc(int[] arrK, int start, int index, int numberN)
    {
        if (index == -1)
        {
            Print(arrK);
        }
        else
        {
            for (int i = start; i <= numberN; i++)
            {
                arrK[index] = i;
                CombinationsCalc(arrK, i + 1, index - 1, numberN);
            }
        }
    }

    static void Print(int[] arrK)
    {
        foreach (var num in arrK)
        {
            Console.Write(num);
        }
        Console.WriteLine();
    }
}
